<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>个人信息</title>
  <meta name="viewport"
    content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
  <link href="phoneContent/plugin/mui/css/mui.css" rel="stylesheet" />
  <link rel="stylesheet" type="text/css" href="phoneContent/css/style.css" />
  <link rel="stylesheet" href="phoneContent/css/Fit.css">
  <style type="text/css">
    .memberInfo_box .mbInfo li select {
      flex: 2;
      padding: 10px 0;
      border: none;
      margin: 0;
    }

    .Voucher {
      flex: 1;
      padding: 10px 0;
      border: none;
      margin: 0;
      max-height: 120px;
    }

    body {
      overflow-y: auto;
    }

    .mui-content {
      margin-bottom: 80px;
      padding-bottom: 0;
    }

    .code-img {
      width: 50px;
      height: 50px;
      margin-left: 10px;
    }

    input {
      outline: none;
      -webkit-appearance: none;
      border-radius: 0;
    }
  </style>
</head>

<body>
  <header class="mui-bar mui-bar-nav bgRed headerTop">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">个人信息</h1>
  </header>
  <div class="mui-content memberInfo_box" id="content">
    <ul class="mbInfo mbInfo1">
      <li><span>头像</span>
        <div class="upimg">
          <img id="headImg" src="phoneContent/img/headImg.png" />
          <!-- <form enctype="multipart/form-data" method="post"><input type="file" name="upload" accept="image/*"
              onchange="doUpload1()" class="upload1"
              style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; opacity: 0;"></form> -->
        </div>
      </li>
      <li><span>ID</span><input value="1234565" type="text" id="id" readonly="readonly"></li>
      <li><span>昵称</span><input value="" type="text" id="nickname" placeholder="请输入昵称"></li>
      <li><span>姓名</span><input value="" type="text" id="name" placeholder="请输入姓名"></li>
      <li><span>真实姓名</span><input value="" type="text" id="zname" placeholder="请输入真实姓名"></li>
      <li><span>账号</span><input autocomplete="off" style="border:0px;outline:none;cursor:pointer;" value="" type="text"
          id="userName" placeholder="请输入账号"></li>
      <li><span>手机号</span><input value="" type="text" id="mobile" placeholder="请输入手机号"></li>
      <!-- <li><span>收货地址</span><input value="" type="text" id="p_tree" placeholder="收货地址"></li> -->
      <!-- <li><span>新密码</span><input autocomplete="off" style="border:0px;outline:none;cursor:pointer;" value=""
          type="password" id="password" placeholder="请输入新密码"></li> -->
    </ul>
    <button class="mui-btn mui-btn-block mui-btn-primary" id="subPay">确定</button>
  </div>

  <script src="phoneContent/js/jquery-3.3.1.js" type="text/javascript" charset="utf-8"></script>
  <script src="phoneContent/plugin/mui/js/mui.js" type="text/javascript" charset="utf-8"></script>
  <script src="phoneContent/js/appcontent.js" type="text/javascript" charset="utf-8"></script>
  <script src="phoneContent/js/Fit.js"></script>
  <script>
    let token = getToken();
    let user = JSON.parse(window.localStorage.getItem('userInfo'));
    if (user) {
      $('#nickname').val(user.name)
      $('#zname').val(user.zName)
      $('#mobile').val(user.mobile)
      $('#name').val(user.name)
      $('#userName').val(user.userName)
      $('#id').val(user.id)
    } else {
      mui.alert("您还未登录，请先登录");
    }

    $("#subPay").click(function () {
      let users = {
        nickname: $('#nickname').val(),
        zname: $('#zname').val(),
        mobile: $('#mobile').val(),
        id: user.id,
        name: $('#name').val(),
        userName: $('#userName').val(),
        // password: $('#password').val(),
      }
      if (checkJson(users) == false) {
        mui.alert("请填写完整");
        return false;
      }
      var res = playPut('/v1/api/users/cz/no', "", users, token);
      if (res.code == 200) {
        mui.alert("修改成功");
        window.localStorage.setItem('userInfo', JSON.stringify(res.users));
        setTimeout(() => {
          location.href = "index.html"
        }, 1000);
      } else {
        mui.alert(res.msg);
      }
    });


  </script>
</body>

</html>